Skip to content

Instantly share code, notes, and snippets.

@zmts
zmts / tokens.md
Last active June 3, 2024 12:09
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
:local CurDate [/system clock get date]
:local CurTime [/system clock get time]
#Log
:log info "Download speed is more than 50M"
#SendTelegram
/tool fetch url="https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<Chat_ID>&text=YourMessage"
@drewolbrich
drewolbrich / View+WindowGeometryPreferences.swift
Last active June 3, 2024 12:08
A visionOS SwiftUI view modifier that can be used to hide a window's resize handles or to constrain a window's aspect ratio
//
// View+WindowGeometryPreferences.swift
//
// Created by Drew Olbrich on 1/30/24.
// Copyright © 2024 Lunar Skydiving LLC. All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@dpaluy
dpaluy / README.md
Last active June 3, 2024 12:07
Download view only protected PDF from Google Drive

Step by step guide to downloading protected PDF from Google Drive

  1. Open the document in Google Docs
  2. Scroll to the bottom of the document, so all the pages are present
  3. Open Developer Tools on separate window and choose the Console tab
  4. Paste the code
  5. Have fun!
@abdullahalsuad
abdullahalsuad / README.md
Created June 3, 2024 11:15 — forked from dpaluy/README.md
Download view only protected PDF from Google Drive

Step by step guide to downloading protected PDF from Google Drive

  1. Open the document in Google Docs
  2. Scroll to the bottom of the document, so all the pages are present
  3. Open Developer Tools on separate window and choose the Console tab
  4. Paste the code
  5. Have fun!
@evenkiel
evenkiel / recursive-delete.ps1
Created June 25, 2012 23:53
Powershell function to recursively delete a folder and all of its child folders and files
#
# Given a root directory, perform a depth first recursive delete of all subdirectories and files.
# Necessary b/c for some reason powershell won't always succeed in a recursive delete of folders which contain
# subfolders
#
function RecursiveDelete($theroot) {
$children = Get-ChildItem -Path $theroot | where-object { $_.Attributes -eq "Directory"} |% {$_.FullName}
foreach($achild in $children) {
if ($achild -ne $null) {
RecursiveDelete $achild
@masklinn
masklinn / cheatsheet.md
Last active June 3, 2024 12:02
launchctl/launchd cheat sheet

I've never had great understanding of launchctl but the deprecation of the old commands with launchctl 2 (10.10) has been terrible as all resources only cover the old commands, and documentation for Apple utilities is generally disgracefully bad, with launchctl not dissembling.

Mad props to https://babodee.wordpress.com/2016/04/09/launchctl-2-0-syntax/ which contains most details

domains

Internally, launchd has several domains, but launchctl 1 would only ask for service names,

@staslysak
staslysak / tokens.md
Created September 17, 2019 21:31 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с данными сохранёнными в базе данных.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

Например после аутентификации юзер sasha получает право обращатся и получать от ресурса "super.com/vip" некие данные. Во время обращения юзера sasha к ресурсу vip система авторизации проверит имеет ли право юзер обращатся к этому ресурсу (проще говоря переходить по неким разрешенным ссылкам)

@ryzmann
ryzmann / Programma Python Moto Armonico.py
Created June 3, 2024 11:58
Programma Python Moto Armonico
import tkinter as tk
from tkinter import messagebox
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,NavigationToolbar2Tk
from matplotlib.animation import FuncAnimation
import math
import numpy as np
import random
class MyGui:
@clydebarrow
clydebarrow / .gitignore
Last active June 3, 2024 12:01
LVGL watch face in ESPHome yaml
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
/secrets.yaml
/wifi.yaml